<?php
class RvscodesController extends AppController{	
	public function add(){
		//$this->rvucode();
	}
	private function rvucode(){		
		App::import('Vendor','excel');	
		$data = new Spreadsheet_Excel_Reader("rvscode.xls");			
		
		$rowcount=$data->rowcount();
		$colcount=$data->colcount();
			
		for($r=2; $r<=$rowcount; $r++){
			$rvscode="";$rvu="";$description="";
			for($c=1; $c<=$colcount; $c++){
				if($c==1){$rvscode=$data->val($r, $c);}
				else if($c==2){$rvu=$data->val($r, $c);}
				else if($c==3){$description=$data->val($r, $c);}				
			}			
			$this->data['Rvscode']['rvscode']=$rvscode;
			$this->data['Rvscode']['rvu']=$rvu;
			$this->data['Rvscode']['description']=$description;			
			
			$this->Rvscode->create();
			$this->Rvscode->save($this->data);		
		}
	}	
	public function getRvs_($rvscode){
		$data=$this->Rvscode->find('all', array('conditions'=>array('rvscode'=>$rvscode)));		
		
		return $data;
	}
	public function getRvs($rvscode, $pan=''){						
		$this->view='Json';
		$data=$this->Rvscode->find('all', array('conditions'=>array('rvscode'=>$rvscode)));
		$data['PCF']=$this->requestAction('/accreditations/getPCF/', array('pass'=>array($pan, '', $data[0]['Rvscode']['rvu'])));
		
		$this->set('data', $data);
		$this->set('json', 'data');
	}
	
}
?>